/** 
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package com.tompai.datagather.twitter.acount;
import java.util.Date;

import com.tompai.common.time.TimeTransUtils;

/*//http://tomkdickinson.co.uk/2015/01/scraping-tweets-directly-from-twitters-search-page-part-2/
*/
public class TweetBean {

	private String id;
	private String text;
	private String userId;
	private String userName;
	private String userScreenName;
	private String userLink;
	private String imgLink;
	private String profile;
	private Date createdAt;
	private int retweets;
	private int favourites;
	
	public TweetBean() {
	}
	
	/*
	 * for follows
	 */
	public TweetBean(String userName,String userScreenName, String profile) {
	
		this.userName=userName;
		this.userScreenName=userScreenName;
		this.profile=profile;
	}

	/*
	 * for twitter targets search
	 */
	
	public TweetBean(String userLink, String userName,String userScreenName,String text,
			Date createdAt, int retweets, int favourites) {
		
		this.userLink=userLink;
		this.userName = userName;
		this.userScreenName = userScreenName;
		this.text = text;
		this.createdAt = createdAt;
		this.retweets = retweets;
		this.favourites = favourites;
	}
	
	/*
	 * for twitter keywords search
	 */
	public TweetBean(String id, String text, String userId, String userName,
			String userScreenName, String userLink,Date createdAt, int retweets, int favourites) {
		this.id = id;
		this.text = text;
		this.userId = userId;
		this.userName = userName;
		this.userScreenName = userScreenName;
		this.userLink=userLink;
		this.createdAt = createdAt;
		this.retweets = retweets;
		this.favourites = favourites;
	}

	
	public String getUserLink() {
		return userLink;
	}

	public void setUserLink(String userLink) {
		this.userLink = userLink;
	}
	
	public String getId() {
		return id;
	}	

	public void setId(String id) {
		this.id = id;
	}

	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserScreenName() {
		return userScreenName;
	}

	public void setUserScreenName(String userScreenName) {
		this.userScreenName = userScreenName;
	}

	public Date getCreatedAt() {
		return createdAt;
	}

	public void setCreatedAt(Date createdAt) {
		this.createdAt = createdAt;
	}

	public int getRetweets() {
		return retweets;
	}

	public void setRetweets(int retweets) {
		this.retweets = retweets;
	}

	public int getFavourites() {
		return favourites;
	}

	public void setFavourites(int favourites) {
		this.favourites = favourites;
	}
	
	public String getImgLink() {
		return imgLink;
	}

	public void setImgLink(String imgLink) {
		this.imgLink = imgLink;
	}

	
	public String getProfile() {
		return profile;
	}

	public void setProfile(String profile) {
		this.profile = profile;
	}

	public String toString(boolean flags){
		
		String formatType = "yyyy-MM-dd HH:mm:ss";
		StringBuffer sb=new StringBuffer();
		
		if (flags) {
			sb.append("creatTime:"+getCreatedAt()+";");
			sb.append("id:"+getId()+";");
			sb.append("text:"+getText()+";");
			sb.append("userId:"+getUserId()+";");
			sb.append("userName:"+getUserName()+";");
			sb.append("userScreenName:"+getUserScreenName()+";");
			sb.append("userLink:"+getUserLink()+";");
			sb.append("favourites:"+getFavourites()+";");
			sb.append("retweets:"+getFavourites()+";");
		}else {
			sb.append(TimeTransUtils.dateToString(getCreatedAt(), formatType)+";");
			sb.append(getUserName()+";");
			//sb.append(getUserScreenName()+";");
			//sb.append(getId()+";");
			sb.append(getText());
			//sb.append(getUserId()+";");
			//sb.append(getUserLink()+";");
			//sb.append(getFavourites()+";");
			//sb.append(getFavourites());
		}
		return sb.toString();
	}
}